<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib uri="/WEB-INF/myTag.tld" prefix="page"%>
<%@ taglib uri="/struts-tags" prefix="s"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%> 
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<META HTTP-EQUIV="Refresh" content="120">
<script type="text/javascript" src="<%=basePath%>/login/scripts/jquery-1.3.2.min.js"></script>
<script type="text/javascript" src="<%=basePath%>/login/scripts/common.js"></script>
<link rel="stylesheet" type="text/css" href="<%=basePath%>/login/css/style.css" />
<link rel="stylesheet" type="text/css" href="<%=basePath%>/login/css/theme1.css" />
<style type="text/css">
#search_bar td {
	border: none;
}

#box td {
	height: 28px;
}

#search_bar {
	width: 920px;
}
.txt_orange{
	color:#FF8F00;
}
</style>
<div id="wrapper" style="margin-top: 10px;">
	<div id="content">
		<div id="box">
			<div>
				<h3>
					当前位置&nbsp;:&nbsp;灾情数据管理&nbsp;>>&nbsp;信息员上报灾情采集&nbsp;>>&nbsp;灾情采集列表
				</h3>
			</div>
			<div id="search_bar">
				<form action="reportAction!reportList.action" method="post">
				<table width="100%" border="0" cellspacing="3" cellpadding="0">
					<tr>
						<td>
							状态:&nbsp;
							<s:select list="#{'':'所有','0':'未上报','1':'已上报'}" name="usrReport.reStatus" value="usrReport.reStatus" theme="simple"></s:select>
							&nbsp;&nbsp;
							灾害类型:&nbsp;<s:select name="usrReport.reType" list="dstypes" listKey="dtName" listValue="dtName" theme="simple" headerKey="" headerValue="所有灾害类型"></s:select>
							&nbsp;&nbsp;
							发生镇区:&nbsp;<s:select name="usrReport.reTown" list="towns" listKey="TName" listValue="TName" theme="simple" headerKey="" headerValue="所有镇区"></s:select>
							&nbsp;&nbsp;
							上报人:&nbsp;<s:select name="usrReport.reMan" list="linkmans" listKey="lmName" listValue="lmName" theme="simple" headerKey="" headerValue="所有上报人"></s:select>
								<input type="submit" value="查询" />
								<c:if test="${admin.role==1}">
									<input type="button" value="导出灾情数据" id="btn_output" />
								</c:if>
								<!-- loading,suc,fail -->
								<span id="loading" style="display: none;"><img src="<%=basePath%>/login/img/blue-loading.gif" height="20" width="20"/>系统正在导出,请稍后...</span>
							</td>
						</tr>
					</table>
				</form>
			</div>
			<table border="0" cellpadding="3" cellspacing="0"
				style="width: 910px;">
				<thead>
					<tr>
						<th>
							<input type="checkbox" id="cb_all" class="cbox_all"
								onclick="javascript: checkAll();"/>
						</th>
						<th>
							上报人
						</th>
						<th>
							灾情类型
						</th>
						<th>
							所在镇区
						</th>
						<th>
							灾情地点
						</th>
						<th>
							上报时间
						</th>
						<th>
							灾情描述
						</th>
						<th>
							来源
						</th>
						<th>
							状态
						</th>
						<th>
							操作
						</th>
					</tr>
				</thead>
				<tbody>
					<c:forEach items="${reportList}" var="report">
						<tr>
							<td class="a-center" width="60">
								<input type="checkbox" class="cbox_one" value="${report.reNum}" />
							</td>
							<td class="a-center" width="60">
								${report.reMan }
							</td>
							<td class="a-center" width="70">
								${report.reType }
							</td>
							<td class="a-center" width="70">
								${report.reTown }
							</td>
							<td class="a-center" width="70">
								${report.reArea }
							</td>
							<td class="a-center" width="80">
								<fmt:formatDate value="${report.reTime }" pattern="yyyy-MM-dd HH:mm"/>
							</td>
							<td class="a-center">
								${report.reStu }
							</td>
							<td class="a-center" width="70">
								${report.reSrc }
							</td>
							<td class="a-center" width="60">
								${report.reStatus=='0'?"未上报":"已上报" }
							</td>
							<td width="160" align="center">
								<a
									href="reportAction!detail.action?usrReport.reNum=${report.reNum }">查看</a>
								<c:if test="${admin.role==1}">
									&nbsp;|&nbsp;
								<a
									href="javascript:forDel('reportAction!reportClear.action?usrReport.reNum=${report.reNum}&usrReport.reStatus=${report.reStatus}');">
									<c:choose>
										<c:when test="${report.reStatus=='0'}">
											<font class="txt_orange">设置为已报</font>
										</c:when>
										<c:otherwise>
											撤销已报
										</c:otherwise>
									</c:choose> </a>&nbsp;|&nbsp;
								<a
									href="reportAction!deleteRe.action?usrReport.reNum=${report.reNum }&usrReport.reStatus=${report.reStatus}">删除</a>
									</c:if>
							</td>
						</tr>
					</c:forEach>
				</tbody>
			</table>
			
			<div id="pager" class="pageDiv">
			<c:if test="${admin.role==1}">
				<div style="float: left; margin-right: 250px;">
					<input type="button" value="添加上报" onclick="javascript:forUp();">
				</div>
				</c:if>
				<div style="float: right; margin-right: 150px;">
				<page:pageDiv url="reportAction!reportList.action" pageBean="${pageBean}" para="usrReport.reStatus=${usrReport.reStatus}&usrReport.reType=${usrReport.reType}&usrReport.reTown=${usrReport.reTown}&usrReport.reMan=${usrReport.reMan}"></page:pageDiv>
				</div>
			</div>
		</div>
		<br />
	</div>
</div>
<script type="text/javascript">
	$(function() {
		$("#cb_all").click(function() {
			if ($(this).attr("checked") == true) {
				$("input[class='cbox_one']").attr("checked", "true");
			} else {
				$("input[class='cbox_one']").removeAttr("checked");
			}
		});
		$("#btn_output").click(function(){
			var url="reportAction!outputExcel.action?time="+new Date().getTime();
			window.location.href=url;
			<%--$.get(url,null,function(data){
				$("#loading").show();
				if(data=="suc"){
					alert("导出成功!");
				}else{
					alert("导出失败!");
				}
				$("#loading").hide();
			});--%>
		});
	});
</script>
